/* -----------------------------------------------------------------------------
 * PROJECT    : lwf_web
 * FILE       : WrongURLResponse.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * May 22, 2012  MyCodeTalks			       Created
 */

package net.lwf.web.filter;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

public class WrongURLResponse extends HttpServletResponseWrapper {

	public WrongURLResponse(HttpServletResponse response) {
		super(response);
	}
	
    /** 
     * Intercepting the errorCode and determing the kind of error using 
     * the errorCode.     
     * @param errorCode - The error status code  
     * @throws IOException 
     */  
    public void sendError(int errorCode) throws IOException {  
        System.out.println("ENTERING THE SENDERROR:" +errorCode);  
        if (errorCode == HttpServletResponse.SC_INTERNAL_SERVER_ERROR){  
            System.out.println("INTERNAL SERVER ERROR OCCURED WITH ERROR AWAREREQUEST WRAPPER");  
            throw new RuntimeException();  
        }  
          
        super.sendError(errorCode);  
    } 

}
